package com.example.moshudriver.protocol;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.external.activeandroid.DataBaseModel;
import com.external.activeandroid.annotation.Column;
import com.external.activeandroid.annotation.Table;

@Table(name = "COUPON")
public class COUPON  extends DataBaseModel
{



     @Column(name = "end_time")
     public String   end_time;

     @Column(name = "content")
     public String   content;

     @Column(name = "money")
     public String   money;

     @Column(name = "area")
     public String   area;

     @Column(name = "type")
     public int type;


     public void  fromJson(JSONObject jsonObject)  throws JSONException
     {
          if(null == jsonObject){
            return ;
           }

          JSONArray subItemArray;

        

          this.end_time = jsonObject.optString("end_time");

   

          this.content = jsonObject.optString("content");
          
          this.area = jsonObject.optString("area");
          
          this.money = jsonObject.optString("money");
          this.type = jsonObject.optInt("type");

       
          return ;
     }

     public JSONObject  toJson() throws JSONException 
     {
          JSONObject localItemObject = new JSONObject();
          JSONArray itemJSONArray = new JSONArray();
          localItemObject.put("end_time", end_time);
          localItemObject.put("content", content);
          localItemObject.put("area", area);
          localItemObject.put("money", money);
          localItemObject.put("type", type);
          return localItemObject;
     }

}
